<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/
get_config_keytable("office_mail_signature");
empty($do) && $do = 'list';
if ($do == 'list') {
    $workdate = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."mailsignature  WHERE uid = '$_USER->id'");
	include_once('template/mailsignature.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$content = getGP('content','P');
	$uid=$_USER->id;
	$id = getGP('id','P','int');
	
	if($id==''){
	//主表信息
	$mailsignature = array(
		'content' => $content,
		'uid' => $uid
	);
	//写入主表信息
	insert_db('mailsignature',$mailsignature);
	$id=$db->insert_id();
	}else{
	
	$mailsignature = array(
		'content' => $content
	);
	update_db('mailsignature',$mailsignature, array('id' => $id));
	
	}
	$content=$content.get_inc_log(1).$uid;
	$title='更新邮件签名';
	get_oa_log_dbadd($id,$content,$title,5,$_USER->id);
	$workdate = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."mailsignature  WHERE uid = '$_USER->id'");
	include_once('template/mailsignature.php');

}
?>